import request from '@/utils/request'

// 获取员工列表
export const userListApi = params => request({
  url: '/sys/user',
  params
})

// 删除员工
export const delUserApi = id => request({
  url: `/sys/user/${id}`,
  method: 'DELETE'
})

// 新增员工
export const addUserApi = data => request({
  url: '/sys/user',
  method: 'POST',
  data
})

// 批量导入员工
export const batchUserApi = data => request({
  url: '/sys/user/batch',
  method: 'POST',
  data
})

// 更新员工基本信息
export const updateUserProfile = data => request({
  url: `/sys/user/${data.id}`,
  method: 'PUT',
  data
})

// 更新员工个人信息
export const updatePersonalProfile = data => request({
  url: `/employees/${data.userId}/personalInfo`,
  method: 'PUT',
  data
})

// 获取岗位基本信息
export const getJobByid = id => request({
  url: `/employees/${id}/jobs`
})

// 保存岗位基本信息
export const updateJobByid = data => request({
  url: `/employees/${data.userId}/jobs`,
  method: 'PUT',
  data
})

// 给员工分配角色
export const assignRolesApi = data => request({
  url: '/sys/user/assignRoles',
  method: 'PUT',
  data
})
